# This program is distributed in the hope that it will be useful (or at
# least amusing), but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program (in the file "COPYING"); if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: Makefile,v 1.9 1998/08/06 07:33:49 eric Exp $

# -----------------------------------------------------------------------------
# You may want or need to change the following definitions.
# -----------------------------------------------------------------------------

SIM_OPTIONS = -DSIM_INST_SET
# VIDEO = 1

DEBUG_OPTIONS = -g

ifdef VIDEO
LDFLAGS = -L/usr/X11R6/lib
LIBS = -lX11
CFLAGS = $(DEBUG_OPTIONS) $(SIM_OPTIONS) -DVIDEO -I/usr/X11R6/include
else
CFLAGS = $(DEBUG_OPTIONS) $(SIM_OPTIONS)
endif

# -----------------------------------------------------------------------------
# You shouldn't have to change anything below this point, but if you do please
# let me know why so I can improve this Makefile.
# -----------------------------------------------------------------------------

PACKAGE = crsim
VERSION = 0.1
DSTNAME = $(PACKAGE)-$(VERSION)

MISC = COPYING Makefile README TODO

HEADERS = crvm.h

SOURCES = debug.c crvm.c crdis.c crinst.c  bplist.c crmem.c


ifdef VIDEO
OBJECTS = crvm.o bplist.o crmem.o crdis.o crinst.o debug.o
else
OBJECTS = crvm.o bplist.o crmem.o crdis.o crinst.o debug.o
endif

DISTFILES = $(MISC) $(SOURCES) $(HEADERS)

all: crsim

clean:
	rm -f *.o crsim

dist: $(DISTFILES)
	-rm -rf $(DSTNAME)
	mkdir $(DSTNAME)
	for f in $(DISTFILES); do ln $$f $(DSTNAME)/$$f; done
	tar --gzip -chf $(DSTNAME).tgz $(DSTNAME)
	-rm -rf $(DSTNAME)

crsim.tar.gz: $(MISC) $(SOURCES) $(HEADERS)
	tar -czf crsim.tar.gz $(MISC) $(SOURCES) $(HEADERS)

crsim: $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)

ifdef VIDEO
crvm.o: crvm.h
else
crvm.o: crvm.h
endif

crinst.o: crvm.h

crdis.o: crvm.h

crmem.o: crvm.h 

debug.o: crvm.h

bplist.o: crvm.h

crvm.o: crvm.h


